﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using FSViet.Survey.Helpers;
using System.Data;
using System.Web.UI.HtmlControls;

namespace FSViet.Survey.Administration.Answer
{
	public partial class List : ListPageBase
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			CheckQuestion();

			if (!IsPostBack)
			{
				if (QuestionId != Guid.Empty)
				{
					LoadData(QuestionId);
				}
			}
		}

		void LoadData(Guid siteId)
		{
			try
			{
				DataHelper dataH = new DataHelper();
				var data = dataH.Load(
					"SELECT * FROM Answers WHERE QuestionId=@QuestionId",
					0,
					100,
					dataH.CreateParam("QuestionId", System.Data.SqlDbType.Char, GlobalApplication.GetGuidS(siteId)));

				ListItem.DataSource = data;
				ListItem.DataBind();
			}
			catch (Exception ex)
			{
				msg.Text = ex.Message;
#if DEBUG
				msg.Text = ex.ToString();
#endif
			}
		}

		string BuildPramToDetails()
		{
			string result = string.Empty;

			return result;
		}
	}
}